package com.plian.system.mapper.sys.excel;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.plian.system.entity.sys.excel.AutoExcel;
import com.plian.system.entity.sys.excel.ExcelBill;
import com.plian.system.entity.sys.excel.ExcelValue;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 自定义表格 Mapper 接口
 *
 * @author
 * @since 2022-09-01
 */
public interface AutoExcelMapper extends BaseMapper<AutoExcel> {

    List<ExcelBill> findByOrgIdAndTableName(@Param("tableName") String tableName,
                                            @Param("orgId") String orgId,
                                            @Param("excelId") String excelId);

    /**
     * 获取 有dataSource dataSourceId 数据问题
     * @param tableName
     * @param excelId
     * @return
     */
    List<ExcelBill> findContainDataSourceByTableName(@Param("tableName") String tableName,
                                            @Param("excelId") String excelId);

    ExcelBill findById(@Param("tableName") String tableName,
                       @Param("id") String id);

    boolean deleteValueByLinkIdAndTableName(@Param("linkId") String linkId,
                                       @Param("tableName") String tableName);

    boolean deleteValueByLinkIdsAndTableName(@Param("linkIds") List<String> linkIds,
                                            @Param("tableName") String tableName);


    boolean saveJzbBill(@Param("tableName") String tableName, @Param("excelBill") ExcelBill excelBill);

    boolean saveBillContainDataSource(@Param("tableName") String tableName, @Param("excelBill") ExcelBill excelBill);

    boolean updatePayrollSettlementId(@Param("tableName") String tableName,
                   @Param("id") String id,
                   @Param("payrollSettlementId") String payrollSettlementId);

    boolean saveValueList(@Param("tableName") String tableName, @Param("excelValueList") List<ExcelValue> excelValueList);

}
